package zhtt.common.aop;

import java.util.Arrays;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;


@Aspect
@Component
public class AuthorizationAdvice {
    // @Before("execution(* com.abc.service.*.many*(..))") @Around
    // ProceedingJoinPoint
    @Before("execution(* zhtt.business.controller.*Controller.*(..))")
    public void permissionCheck(JoinPoint point) throws Throwable {
        System.out.println("@Before "
                + point.getSignature().getDeclaringTypeName() + "."
                + point.getSignature().getName());
        System.out.println("@Before " + Arrays.toString(point.getArgs()));
        Object[] args = point.getArgs();
        System.out.println(args.length);
        for (Object o : args) {
            if (o instanceof HttpServletResponse){
        		HttpServletResponse response=(HttpServletResponse) o;
        		//response.sendRedirect("/HomeController/addUser.do");
        		System.out.println("存在！");
        	}
        }
    }
}